var _serviceURL = '/69mark/web';// 必须设置
$(function() {
	doPage(1);
});

function doPage(page){
	var userId = $("#userId").val();
	var createTime = $("#createTime").val();
	$.ajax({
   		type : "POST",
   		url : _serviceURL+"/toListAllSecSchedule.do",
   		cache : false,
   		data : "pageNo="+page+"&pageSize=10&userId="+userId+"&createTime="+createTime,
   		dataType : 'json',
   		success : function(data) {
   			var result = "";
   			for(var i=0;i<data.menuList.length;i++){
   				
   				var t=data.menuList[i].created_time.time;
   				var d=	new Date();
   				d.setTime(t);
   				var date=d.format('yyyy-MM-dd HH:mm:ss');
   				
   				result += "<tr>";
   				result += "<td>"+data.menuList[i].title+"</td>";
   				result += "<td>"+data.menuList[i].nickname+"</td>";
   				result += "<td>"+data.menuList[i].shop_province+""+data.menuList[i].shop_city+""+data.menuList[i].shop_district+""+data.menuList[i].shop_address+"</td>";
   				result += "<td>"+date+"</td>";
   				result += "<td>";
   				result += "<a href=\""+_serviceURL+"/toSecChakan.do?id="+data.menuList[i].ss_id+"\" title=\"查看\">查看</a>";
   				result += "<a href=\"\" onclick=\"delfuncitem('"+data.menuList[i].ss_id+"');return false;\" style=\"margin-left:10px;\" title=\"删除\">删除</a>";
   				result += "</td>";
   				result += "</tr>";
   			}
   			
   			$("#heightList").html(result);
   			$("#page_user").html(data.navi);
   			
   			$("#userId").val("");
   			$("#createTime").val("");
   		}
	})
	
}

Date.prototype.format=function(fmt) {
    var o = {        
    "M+" : this.getMonth()+1, //月份        
    "d+" : this.getDate(), //日        
    "h+" : this.getHours()%12 == 0 ? 12 : this.getHours()%12, //小时        
    "H+" : this.getHours(), //小时        
    "m+" : this.getMinutes(), //分        
    "s+" : this.getSeconds(), //秒        
    "q+" : Math.floor((this.getMonth()+3)/3), //季度        
    "S" : this.getMilliseconds() //毫秒        
    };        
    var week = {        
    "0" : "\u65e5",        
    "1" : "\u4e00",        
    "2" : "\u4e8c",        
    "3" : "\u4e09",        
    "4" : "\u56db",        
    "5" : "\u4e94",        
    "6" : "\u516d"       
    };        
    if(/(y+)/.test(fmt)){        
        fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));        
    }        
    if(/(E+)/.test(fmt)){        
        fmt=fmt.replace(RegExp.$1, ((RegExp.$1.length>1) ? (RegExp.$1.length>2 ? "\u661f\u671f" : "\u5468") : "")+week[this.getDay()+""]);        
    }        
    for(var k in o){        
        if(new RegExp("("+ k +")").test(fmt)){        
            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));        
        }        
    }        
    return fmt;        
} 


//身高搜索
function serchName(){
	doPage(1);
}

//删除
function delfuncitem(thisid){
    layer.confirm('确定删除？',{btn:['确定','取消']},function(){
            $.ajax({
                type:'POST',
                url:_serviceURL+'/toDeleteSecScheduleId.do',
                data:'id='+thisid,
                dataType : 'json',
                success:function(data){
                    if(data==1){
                        layer.msg('删除成功',{
                            time: 2000,
                        });
                        doPage(1);
                    }else{
                        layer.msg('删除失败',{
                            time: 2000,
                        });
                    }
                }
            });
        }
    );
}


